package class1.s2022350143028.controller;

import base.controller.GoodsBaseController;
import class1.s2022350143028.service.Impl.GoodssxyServiceImpl;

import java.util.Scanner;

public class GoodsController extends GoodsBaseController {
    //todo 自行完成扩展

    public void main(){
        while(true){
            System.out.println("----------------------");
            System.out.println("0.返回首页");
            System.out.println("1.查询商品");
            System.out.println("2.商品录入");
            System.out.println("3.商品删除");
            System.out.println("4.库存管理");
            System.out.println("----------------------");

            GoodssxyServiceImpl goodslmpl=new GoodssxyServiceImpl();

            Scanner sc = new Scanner(System.in);
            Scanner Sc = new Scanner(System.in);
            System.out.println("请输入你的选择");
            int choice = sc.nextInt();
            boolean flag=true;
            switch (choice){
                case 0:{
                    flag=false;
                    break;
                }
                case 1:{ //查询商品
                    goodslmpl.getGood();
                    break;
                }
                case 2:{ //商品录入
                    goodslmpl.addGoods();
                    break;
                }
                case 3:{//商品删除
                    System.out.println("请输入你要删除的商品编号：");
                    String goodId=Sc.next();
                    goodslmpl.delete(goodId);
                    break;
                }
                case 4:{//库存管理
                    goodslmpl.setInventory();
                    break;
                }

            }
            if(!flag)break;
        }
        return;

    }


}
